package com.tr.rentcar.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONArray;
import com.tr.rentcar.model.bean.PlaceStore;
import com.tr.rentcar.model.dao.PlaceDao;

@WebServlet("/updateaddress")
public class AddressController extends HttpServlet {

	/**
	 * 门店下拉列表动态改变
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try {
			String pid=req.getParameter("pid");
			List<PlaceStore> psList=new PlaceDao().getAllByid(pid);
			req.setAttribute("pslist", psList);
			PrintWriter out=resp.getWriter();
			out.println(JSONArray.toJSONString(psList));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
